# Contributor: Bart Ribbers <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-applications
maintainer="team/kde <bribbers@disroot.org>"
pkgname=korganizer
pkgver=24.08.2
pkgrel=0
# armhf blocked by extra-cmake-modules
# ppc64le, s390x, riscv64 and armv7 blocked by qt6-qtwebengine -> kmailtransport
# loongarch64 blocked by pimcommon
arch="all !armhf !ppc64le !s390x !riscv64 !armv7 !loongarch64"
url="https://apps.kde.org/korganizer/"
pkgdesc="The calendar and scheduling component of Kontact"
license="GPL-2.0-or-later"
depends="kdepim-runtime"
makedepends="
	akonadi-calendar-dev
	akonadi-contacts-dev
	akonadi-dev
	akonadi-mime-dev
	akonadi-notes-dev
	akonadi-search-dev
	calendarsupport-dev
	eventviews-dev
	extra-cmake-modules
	incidenceeditor-dev
	kcalendarcore-dev
	kcalutils-dev
	kcmutils-dev
	kcodecs-dev
	kcompletion-dev
	kconfig-dev
	kconfigwidgets-dev
	kcontacts-dev
	kcoreaddons-dev
	kcrash-dev
	kdbusaddons-dev
	kdoctools-dev
	kholidays-dev
	kiconthemes-dev
	kidentitymanagement-dev
	kitemviews-dev
	kjobwidgets-dev
	kldap-dev
	kmailtransport-dev
	kmime-dev
	knewstuff-dev
	knotifications-dev
	kontactinterface-dev
	kparts-dev
	kpimtextedit-dev
	kservice-dev
	kuserfeedback-dev
	kwidgetsaddons-dev
	kwindowsystem-dev
	kxmlgui-dev
	libkdepim-dev
	phonon-dev
	pimcommon-dev
	qt6-qtbase-dev
	samurai
	"
checkdepends="
	dbus
	xvfb-run
	"
subpackages="$pkgname-doc $pkgname-lang"
_repo_url="https://invent.kde.org/pim/korganizer.git"
source="https://download.kde.org/stable/release-service/$pkgver/src/korganizer-$pkgver.tar.xz"

replaces="kdepim-addons<=24.05.2-r0"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	dbus-run-session -- xvfb-run ctest --test-dir build --output-on-failure -E "reparentingmodel|akonadi-(mysql|sqlite)-koeventpopupmenutest"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
443c19fe86cfaea74d89a3104eb011e48c6fc3054b5c51c8db4cfaff285c63c2e1af3fe245f8fb967b8ed7c66d0eabf510dc1f68c7d49f77ab63c2693cc1bf65  korganizer-24.08.2.tar.xz
"
